cmake_minimum_required(VERSION 3.16)

project(qtcpp_demo VERSION 1.0 LANGUAGES CXX)

message(${PROJECT_SOURCE_DIR})

set(QTCPPDEMO_BIN_DIR  ${PROJECT_BINARY_DIR}/bin)
set(QTCPPDEMO_THIRDIR  ${PROJECT_SOURCE_DIR}/3rdlibs)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QTCPPDEMO_BIN_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QTCPPDEMO_BIN_DIR})

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
	set(QCD64BIT True )
else()
	set(QCD64BIT False )
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
	set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
	#Set utf-8 as default encoding for MSVC compiler
	if(MSVC)
		add_compile_options("-utf-8")
	endif()
endif()

add_subdirectory(chesspi)
add_subdirectory(closure)
add_subdirectory(cpp_rv_ref)
add_subdirectory(cpp_threadpool)
add_subdirectory(fileLoadControl)
add_subdirectory(find0xff)
add_subdirectory(findfoo)
add_subdirectory(floodfill_mdf)
add_subdirectory(huarongdao)
add_subdirectory(kafka)
add_subdirectory(msys2midl)
add_subdirectory(msys2qtdeployplus)
add_subdirectory(nmcalc)
add_subdirectory(omp_threadpool)
add_subdirectory(pcapio)
add_subdirectory(profile_log)
add_subdirectory(qflightinstruments)
add_subdirectory(qt_coro_test)
add_subdirectory(qt_event_signal)
add_subdirectory(qudpspectrum)
add_subdirectory(sharedptr_ndarray)
add_subdirectory(string_split)
add_subdirectory(syn_git)
add_subdirectory(tunnel_speed)
add_subdirectory(udp_loss_test)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	message(STATUS "OS:Linux")
	add_subdirectory(primer_calc)
	add_subdirectory(qt_fcgi)	
        add_subdirectory(back_tracer)
	add_subdirectory(qtvision_editor)
	add_subdirectory(sdr_deepdetect)
	add_subdirectory(uhd_cpp)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	message(STATUS "OS:Windows")
	if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
		message("COMPILER:MinGW")
		add_subdirectory(primer_calc)
		add_subdirectory(back_tracer)
		add_subdirectory(qtvision_editor)
		add_subdirectory(sdr_deepdetect)
		add_subdirectory(uhd_cpp)
	elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
		message("COMPILER:MSVC")
	elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
		message("COMPILER:Clang")
		add_subdirectory(primer_calc)
		add_subdirectory(qtvision_editor)
		add_subdirectory(sdr_deepdetect)
		add_subdirectory(uhd_cpp)
	endif()
endif()

